import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入年份：");
        int year = sc.nextInt();
        System.out.println("请输入月份：");
        int month = sc.nextInt();
        System.out.println("请输入日子：");
        int day = sc.nextInt();
        int[] ret = new int[]{31,28,31,30,31,30,31,31,30,31,30,31};
        int days = 0;
        //判断是否是闰年
        if((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
            ret[1]++;
        }
        for (int i = 0; i < month - 1; i++) {
            days += ret[i];
        }
        System.out.println(days + day);
    }
}

